package com.itheima.d1_properties;

import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.util.Properties;

/*
    目标：掌握把键值对数据存入到属性文件中去
        public void store(OutputStream os, String comments)	把键值对数据，通过字节输出流写出到属性文件里去
        public void store(Writer w, String comments)	把键值对数据，通过字符输出流写出到属性文件里去
        public void load(InputStream is)	通过字节输入流，读取属性文件里的键值对数据
        public void load(Reader reader)	通过字符输入流，读取属性文件里的键值对数据
 */
public class PropertiesTest2 {
    public static void main(String[] args) throws Exception {
        Properties properties = new Properties();
        properties.setProperty("亚瑟","旋转");
        properties.setProperty("妲己","诱惑");
        properties.setProperty("后羿","放鸟");
        properties.setProperty("猴子","抡棍");

        System.out.println(properties);

        properties.store(new FileWriter("user3.properties"),"测试是不是乱码");;

        main02();
    }


    public static void main02() throws Exception {
        Properties properties = new Properties();
        properties.load(new FileReader("user3.properties"));

        System.out.println(properties);

    }

}
